# Maintainer: kpcyrd <kpcyrd[at]archlinux[dot]org>
# Contributor: Vlad M. <vlad@archlinux.net>

pkgname=cargo-watch
pkgver=8.4.0
pkgrel=1
pkgdesc="Utility for Cargo to compile projects when sources change"
url='https://github.com/passcod/cargo-watch'
arch=('loong64' 'x86_64')
license=('CC0-1.0')
depends=('cargo')
makedepends=('ruby-ronn')
source=("https://github.com/passcod/${pkgname}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('8da79b5e4606d609af4d995038e9edb2425466bc162f3b0f7f2b2f6133a2e01d')
b2sums=('2ecfe5e6785d71b393a2a5ddb93b59e230d8f7dfa4e6e16f462e8c511c1c8524ef24c0e66ea3d906d12171b5ca0e9ba3a29a1fe09ee89b564d46a1b47b3f8aae')

prepare() {
  cd "${pkgname}-${pkgver}"
  cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

build() {
  cd ${pkgname}-${pkgver}
  cargo build --frozen --release
  ronn --roff cargo-watch.1.ronn
}

package() {
  cd ${pkgname}-${pkgver}
  install -Dm 755 "target/release/${pkgname}" -t "${pkgdir}/usr/bin"

  install -Dm 644 completions/zsh "${pkgdir}/usr/share/zsh/site-functions/_cargo-watch"
  install -Dm 644 cargo-watch.1 -t "${pkgdir}/usr/share/man/man1"

  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
